import { SingleInstance } from './singleinstance'
import { until, By } from 'selenium-webdriver';


async function run(){
    const driver = SingleInstance.create_driver();
    await driver.get("https://www.baidu.com/");
    const input = await driver.findElement({css:'#kw'});
    await input.sendKeys("helloworld");

    const btn = await driver.findElement({css:'#su'});
    await btn.click();

    //  等待元素加载出来 最长等待时间为10秒
    const res = await driver.wait(until.elementLocated(By.css('div[id="1"]>h3>a')),10*1000);
    // await driver.sleep(2000);
    // const res = await driver.findElement({css:'div[id="1"]>h3>a'});
    await res.click();
}

run();
